<?php 
class mycogClassAction extends Action
{
	
	public function defaultAction()
	{
		$type = $this->get('type');
		$this->assign('type', $type);
	}
	
	public function getxings($str)
	{
		if(!isempt($str))$str = substr($str,0,3).'*****'.substr($str,-4);
		return $str;
	}
	
	
	public function savecheckAction()
	{
		$type = $this->post('type');
		
		if(!$type){
			$face = $this->post('face');
			$uarr['name'] = $this->post('name');
			if(!isempt($face))$uarr['face'] = $face;
			if(isempt($uarr['name']))return '姓名不能为空';
			m('users')->update($uarr, $this->adminid);
		}
		
		return 'ok';
	}
	
	public function companyformAction()
	{
		$id = (int)$this->get('id','0');
		$this->smartydata['id'] = $id;
			
		$fields = c('fields')->getArr('company');
		$rs 	= $fields['data'];
		$fobj 	= $fields['fieldsobj'];
		$rs['logopic'] = 'images/nologo.png';
		
		if($id>0){
			$rs 	= m('company')->getone('`id`='.$id.'');
			if(!isempt($rs['logo']))$rs['logopic'] = $rs['logo'];
		}
		
		$this->assign('fieldsobj', $fobj);
		$this->assign('data', $rs);
	}
	
}